package com.eudon.genius.api.starter.config;

import com.eudon.genius.api.core.dto.AppInfo;
import com.eudon.genius.api.core.dto.PropertiesDto;
import com.eudon.genius.api.core.parser.JavaParserDocParser;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * genius api 自动化配置类
 *
 * @author eudon
 * @since 2025/9/25
 */
@Configuration
@EnableConfigurationProperties(GeniusProperties.class)
public class GeniusApiAutoConfiguration implements CommandLineRunner {

    private final GeniusProperties geniusProperties;

    public GeniusApiAutoConfiguration(GeniusProperties geniusProperties) {
        this.geniusProperties = geniusProperties;
    }

    @Override
    public void run(String... args) throws Exception {
        PropertiesDto.Dto dto = new PropertiesDto.Dto();
        dto.setAppDescription(geniusProperties.getAppDesc());
        dto.setBasePackage(geniusProperties.getBasePackage());
        dto.setOrganization(geniusProperties.getOrganization());
        dto.setDeveloper(geniusProperties.getDeveloper());
        dto.setAppName(geniusProperties.getAppName());
        PropertiesDto propertiesDto = new PropertiesDto(dto);

        JavaParserDocParser parser = new JavaParserDocParser(propertiesDto);
//        AppInfo appInfo = parser.parsePackage();

    }
}
